<template>
	<view>
		{{arr}}
		<button @click="changeArr('add')">+</button>
		<button @click="changeArr('sub')">-</button>
		<button @click="shake">shake</button>
		<Dice></Dice>
	</view>
</template>
<script setup lang="uts">
import { ref } from 'vue';
	const arr = ref([1])
	const shake = ()=>{
		arr.value = arr.value.map(item=>{
			return transformNumber(1,6)
		})
	}
	const transformNumber = (min:number,max:number)=>{
		return Math.floor(Math.random()*max)+min;
	}
	const changeArr = (type:string)=>{
		if(type=='add'){
			arr.value.push(1)
		}else if(type=='sub'){
			arr.value.shift()
		}else{
			
		}
	}
</script>
<style lang="scss" scoped>
</style>